package com.nuanshui.heatedloan.credit.service;

import com.nuanshui.framework.consts.TransactionManagerType;
import com.nuanshui.heatedloan.constant.ServiceConstant;
import com.nuanshui.heatedloan.credit.dal.mapper.CustomerCreditResultMapper;
import com.nuanshui.heatedloan.credit.facade.CustomerCreditResultService;
import com.nuanshui.heatedloan.credit.form.CustomerCreditResultForm;
import com.nuanshui.heatedloan.credit.vo.CustomerCreditResultVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * Created by wangxw on 2017/7/12.
 */

@Service(ServiceConstant.CUSTOMERCREDITRESULTSERVICE)
@Transactional(readOnly=true,value= TransactionManagerType.CREDIT_TRANSACTION_MANAGER)
public class CustomerCreditResultServiceImpl implements CustomerCreditResultService {

    @Autowired
    private CustomerCreditResultMapper customerCreditResultMapper;

    @Override
    public CustomerCreditResultVO loadVOByUserId(String userId) {
        return customerCreditResultMapper.loadVOByUserId(userId);
    }

    @Override
    @Transactional(readOnly=false,value= TransactionManagerType.CREDIT_TRANSACTION_MANAGER)
    public void updateByUserId(CustomerCreditResultForm customerCreditResultForm) {
        customerCreditResultMapper.updateByUserId(customerCreditResultForm);
    }

    @Override
    @Transactional(readOnly=false,value= TransactionManagerType.CREDIT_TRANSACTION_MANAGER)
    public void save(CustomerCreditResultForm customerCreditResultForm) {
        customerCreditResultMapper.save(customerCreditResultForm);
    }

    @Override
    @Transactional(readOnly=false,value= TransactionManagerType.CREDIT_TRANSACTION_MANAGER)
    public void updateStatus(String userId){
        customerCreditResultMapper.updateStatus(userId);
    }
}
